<?php echo link_to('жагсаалт', 'banner/index', array('class'=>'title'))?> 
<span class="separator"> | </span>
<?php echo link_to('шинээр нэмэх', 'banner/new', array('class'=>'title'))?>
<br clear="all">
<br clear="all">
<br clear="all">

<?php $widths = myConstants::getBannerPositionWidths();?>

<form action="<?php echo url_for('banner/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <table>
    <tfoot>
      <tr>
        <td colspan="2">
          <?php echo $form->renderHiddenFields(false) ?>
          <input type="submit" value="Хадгалах"/>
          &nbsp;<a href="<?php echo url_for('banner/index') ?>">Жагсаалтруу буцах</a>
        </td>
      </tr>
    </tfoot>
    <tbody>
      <?php echo $form->renderGlobalErrors() ?>
      <tr>
        <th><?php echo $form['title']->renderLabel() ?></th>
        <td>
          <?php echo $form['title']->renderError() ?>
          <?php echo $form['title'] ?>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['path']->renderLabel() ?></th>
        <td>
          <?php echo $form['path']->renderError() ?>
          <?php echo $form['path'] ?>
          <div class="description"><?php echo $form['path']->renderHelp() ?></div>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['link']->renderLabel() ?></th>
        <td>          
          <?php echo $form['link']->renderError() ?>
          <?php echo $form['link'] ?>

          <label class="clean">
            <?php echo $form['target']->renderError() ?>
            <?php echo $form['target'] ?>
            <span class="description"><?php echo $form['target']->renderHelp() ?></span>
          </label>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['position']->renderLabel() ?></th>
        <td>
          <?php echo $form['position']->renderError() ?>
          <?php echo $form['position'] ?>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['width']->renderLabel() ?></th>
        <td>
          <?php echo $form['width']->renderError() ?>
          <?php echo $form['width'] ?>
          <span class="description"><?php echo $form['width']->renderHelp() ?></span>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['height']->renderLabel() ?></th>
        <td>
          <?php echo $form['height']->renderError() ?>
          <?php echo $form['height'] ?>
          <span class="description"><?php echo $form['height']->renderHelp() ?></span>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['sort']->renderLabel() ?></th>
        <td>
          <?php echo $form['sort']->renderError() ?>
          <?php echo $form['sort'] ?>
          <span class="description"><?php echo $form['sort']->renderHelp() ?></span>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['start_date']->renderLabel() ?></th>
        <td>
          <?php echo $form['start_date']->renderError() ?>
          <?php echo $form['start_date'] ?>
          <span class="description"><?php echo $form['start_date']->renderHelp() ?></span>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['end_date']->renderLabel() ?></th>
        <td>
          <?php echo $form['end_date']->renderError() ?>
          <?php echo $form['end_date'] ?>
          <span class="description"><?php echo $form['end_date']->renderHelp() ?></span>
        </td>
      </tr>
    </tbody>
  </table>
</form>

<script type="text/javascript">
  changePos();
  
  function changePos()
  {
    var widhts = <?php echo json_encode($widths)?>;
    var id = $("#banner_position").val();
    $("#banner_width").val(widhts[id]);
  }
</script>